package com.mark.basic.config;

import com.mark.basic.interceptor.LoginInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
public class WebConfigurer implements WebMvcConfigurer {
    @Autowired
    private LoginInterceptor loginInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(loginInterceptor)
                .addPathPatterns("/**")// 拦截的地址
                // 放行的地址
                .excludePathPatterns("/login/**") // 登录
                .excludePathPatterns("/user/register/**") // 注册
                .excludePathPatterns("/verifyCode/**") // 验证码
                .excludePathPatterns("/fastDfs"); // 文件的上传下载
    }
}